//
//  LLLogger.m
//  LLFoundation
//
//  Created by my_liu on 2016/11/14.
//  Copyright © 2016年 . All rights reserved.
//

#import "LLLogger.h"
#import <CocoaLumberjack/CocoaLumberjack.h>
#import "LLLogFormatter.h"

@implementation LLLogger


+ (instancetype)share
{
    static LLLogger *logger;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        logger = [[LLLogger alloc] init];
    });
    return logger;
}

- (void)initLogger
{
    LLLogFormatter *formatter = [[LLLogFormatter alloc] init];
    
    [[DDASLLogger sharedInstance] setLogFormatter:formatter];
    [[DDTTYLogger sharedInstance] setLogFormatter:formatter];
    
    [DDLog addLogger:[DDASLLogger sharedInstance]];
    [DDLog addLogger:[DDTTYLogger sharedInstance]];
    
    DDFileLogger *fileLogger = [[DDFileLogger alloc] init];
    
    fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling
    
    fileLogger.logFileManager.maximumNumberOfLogFiles = 7;
    
    [DDLog addLogger:fileLogger];
}



@end
